<template>
    <div>
        <node :show-checkbox="showCheckbox" v-for="(item, index) in data" :data="item" :key="index"></node>
    </div>
</template>

<script>
    import Node from './node.vue'

    export default {
        name: 'niubiTree',
        components: {
            Node
        },
        props: {
            data: {
                type: Array,
                default() {
                    return [];
                }
            },
            childrenKey: { // child的key
                type: String,
                default: 'children'
            },
            showCheckbox: {
                type: Boolean,
                default: false
            }
        },
        provide() {
            return {
                childrenKey: this.childrenKey
            }
        }
    }
</script>

<style lang='less'>

</style>
